home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sound Fx
/
Sound Fx.iso
/
Software
/
UNZIPED
/
CWPA45D
/
SPLITNOT.CA_
/
SPLITNOT.bin
Wrap
Text File
|
1996-05-20
|
4KB
|
123 lines
;
; Splitnot.cal
;
; This routine modifies a source track, splitting it by note# into
; separate destination tracks. Only notes are split ... all other
; track parameters (Controllers, Tempos, Meters and Markers),
; if any, remain in the source track.
;
; Use this routine for splitting up a drum machine or other type
; of instrument track where voices are assigned by note number.
;
; = Courtesy Red Nile Productions 1993 (714)498-7515 CIS:70044,2733
;
; = Modified 12/10/93 by Greg Hendershott at user's request to
; have this display notes as names (like C#5) rather than numbers
; in the track names. Caveat: The note names always use sharps
; and assume BaseOctave=0.
(do
(if (< VERSION 20)
(do
(pause "This CAL program requires CAL version 2.0 or higher")
(exit)
)
)
(include "need20.cal") ; Require version 2.0 or higher of CAL
(int nOctave)
(int nSrcTrk 1)
(int nDestTrk (+ nSrcTrk 1))
(int nDestChan 0)
(int nDestPort 1)
(int nNote 0)
(int bEvent FALSE)
(getInt nSrcTrk "Source Track?" 1 256)
(-- nSrcTrk) ; CAL uses 0..255
(getInt nDestTrk "First Destination Track?" 1 256)
(-- nDestTrk) ; CAL uses 0..255
(getInt nDestChan "Destination Channel?" 0 16)
(-- nDestChan) ; CAL uses -1..15
(getInt nDestPort "Destination Port?" 1 16)
(-- nDestPort) ; 0 .. 15
; If markers not set, select entire range
(if (== From Thru)
(do
(= From 0)
(= Thru End)
)
)
; Select only source track
(TrackSelect 0 -1)
(TrackSelect 1 nSrcTrk)
; Set filter params. Split notes only ..
; Controllers stay in source track.
(ResetFilter 0 TRUE)
(SetFilterKind 0 NOTE TRUE)
(SetFilterKind 0 KEYAFT FALSE)
(SetFilterKind 0 CONTROL FALSE)
(SetFilterKind 0 PATCH FALSE)
(SetFilterKind 0 CHANAFT FALSE)
(SetFilterKind 0 WHEEL FALSE)
(while (< nNote 127)
(do
; Check for note events at current note # ...
(forEachEvent
(if (&& (== Event.Kind NOTE) (== Note.Key nNote))
(= bEvent TRUE)
)
)
; If there are note events, paste them to the destination track
(if (== bEvent TRUE)
(do
; Status message
(message "Note # " nNote " --> Track " (+ 1 nDestTrk))
; Set up filter .. item 0, NOTE, in the range nNote..nNote
(SetFilterRange 0 0 TRUE nNote nNote)
; Cut/Paste the filtered events to the destintation track
(EditCut From Thru TRUE TRUE FALSE FALSE FALSE FALSE)
(EditPasteToTrack From 1 1 TRUE FALSE FALSE FALSE nDestTrk)
; Name dest track
(= nOctave (/ nNote 12))
(switch (% nNote 12)
0 (TrackName (format "Split Note C" nOctave) nDestTrk)
1 (TrackName (format "Split Note C#" nOctave) nDestTrk)
2 (TrackName (format "Split Note D" nOctave) nDestTrk)
3 (TrackName (format "Split Note D#" nOctave) nDestTrk)
4 (TrackName (format "Split Note E" nOctave) nDestTrk)
5 (TrackName (format "Split Note F" nOctave) nDestTrk)
6 (TrackName (format "Split Note F#" nOctave) nDestTrk)
7 (TrackName (format "Split Note G" nOctave) nDestTrk)
8 (TrackName (format "Split Note G#" nOctave) nDestTrk)
9 (TrackName (format "Split Note A" nOctave) nDestTrk)
10 (TrackName (format "Split Note A#" nOctave) nDestTrk)
11 (TrackName (format "Split Note B" nOctave) nDestTrk)
)
; Set forced channel & port, and unmute it
(TrackChannel nDestChan nDestTrk)
(TrackPort nDestPort nDestTrk)
(TrackActive TRUE nDestTrk)
(++ nDestTrk)
(= bEvent FALSE)
)
)
; Else
(++ nNote)
)
)
)